@model DNA.Mvc.Management.WebStatistics
@{

    Ajax.Dna().Widget()
   .UserPreferences(@<text>
    <div>
        @item.PropertyDescriptors["Minutes"].DisplayName</div>
    <div>
        @(
 Ajax.Dna().TextBox(item.GenerateFieldID("Minutes"))
                .Value(item.UserPreferences["Minutes"] != null ? item.GetInt("Minutes") : 0)
                .NumericOnly()
                .GetHtml()
        )
    </div>
    </text>)
   .Content(@<text>
    @{
        var _guests = Model.OnlineGuests;
        var _registers = Model.OnlineRegisters; 
        var _total = (Model.OnlineGuests != null ? Model.OnlineGuests.Length : 0) + (Model.OnlineRegisters != null ? Model.OnlineRegisters.Length : 0);
        
        }
    <div style="padding: 5px; overflow: auto;">
        @MvcHtmlString.Create(string.Format(Html.Global("WhoIsOnline"), _total, Model.OnlineRegisters.Length, Model.OnlineGuests.Length, item.GetInt("Minutes"), Model.MostOnlineCount, Model.MostOnlinedUtc.ToShortDateString()))
        <table style="margin-top: 5px;">
            <tr>
                <td>
                    <img style="float: left;margin-right:5px;" src="@Url.Content("~/content/images/icon_users_16.png")" alt="TotolMembers" />
                    @Html.Global("WhoIsOnline_TotalMembers") : @Model.RegistedUserCount
                </td>
            </tr>
            <tr>
                <td>
                    <img class="d-icon" src="@Url.Content("~/content/images/icon_pageview_16.gif")" alt="PageView" />
                    @Html.Global("RES_PAGEVIEWS")
                    :@Model.PageViews
                </td>
            </tr>
            <tr>
                <td>
                    <img class="d-icon" src="@Url.Content("~/content/images/icon_ip_16.gif")" alt="Visits" />
                    @Html.Global("WhoIsOnline_Visits") : @Model.Visitors 
                </td>
            </tr>
        </table>
        @if ((_registers != null) && (_registers.Length > 0))
        {
            <div style="margin-top: 10px; margin-bottom: 10px;">
                <img style="float: left;margin-right:5px;" src="@Url.Content("~/content/images/icon_group_16.gif")" alt="RegisterUser" />
                @Html.Global("WhoIsOnline_RegistedUsers") :
            </div>
            <div style="float: left;">
                @foreach (var user in _registers)
                {
                    var _regUser = Membership.GetUser(user);
                    <a href="@_regUser.GetPermalinkUrl().ToString()" rel="nofollow" title="@user" class="d-avatar"  style="float: left;padding:1px; margin: 0px 2px 2px 0px;">
                        <img src="@_regUser.GetAvatar()" alt="@user" width="16" height="16"  />
                    </a>
                }
            </div>
            <span style="clear: both;"></span>
        }
    </div>
    </text>)
          .Render();
       
}
